<template>
  <a-modal v-model="visible" :width="1080" title="选择大额支付" @ok="batchSelectItem">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="支付订单号">
              <a-input placeholder="请输入支付订单号" v-model="queryParam.payOrderNo"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="用户ID">
              <a-input placeholder="请输入用户ID" v-model="queryParam.uid"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="1=待审核，2=审核通过，3=审核拒绝">
                <a-input placeholder="请输入1=待审核，2=审核通过，3=审核拒绝" v-model="queryParam.status"></a-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="创建时间">
                <j-date placeholder="请选择创建时间" v-model="queryParam.createTime"></j-date>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>

      <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:selectionType}" class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
<template slot="imgSlot" slot-scope="text">
  <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  <img v-else :src="getImgView(text)" height="55px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;" />
</template>
<template slot="fileSlot" slot-scope="text">
  <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
    下载
  </a-button>
</template>

<span slot="action" slot-scope="text, record">
<a v-if="selectionType=='radio'" @click="selectItem(record)">选择</a>
        </span>

        </a-table>
        </div>

        </a-modal>
        </template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/MyJeecgListMixin'

import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
import JDate from '@/components/jeecg/JDate.vue'

export default {
  name: 'OmsPayOfflineList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    JDictSelectTag,
    JDate,
  },
  data () {
    return {
      pageCheckedKeys: [],
      noPageCheckedKeys: [],
      pageCheckedRows: [],
      noPageCheckedRows: [],
      visible: false,
      description: '大额支付管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '支付订单号',
          align: "center",
          dataIndex: 'payOrderNo'
        },
        {
          title: '用户ID',
          align: "center",
          dataIndex: 'uid'
        },
        {
          title: '1=待审核，2=审核通过，3=审核拒绝',
          align: "center",
          dataIndex: 'status_dictText'
        },
        {
          title: 'refuseReason',
          align: "center",
          dataIndex: 'refuseReason'
        },
        {
          title: '创建时间',
          align: "center",
          dataIndex: 'createTime',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '更新时间',
          align: "center",
          dataIndex: 'updateTime',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: ' "账号类型：1=个人账户，2=企业账户"',
          align: "center",
          dataIndex: 'type_dictText'
        },
        {
          title: '"持卡人姓名',
          align: "center",
          dataIndex: 'accountName'
        },
        {
          title: '开户行',
          align: "center",
          dataIndex: 'bankAccount'
        },
        {
          title: '银行卡号',
          align: "center",
          dataIndex: 'accountNumber'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/modules.order/omsPayOffline/list",
        delete: "/modules.order/omsPayOffline/delete",
        deleteBatch: "/modules.order/omsPayOffline/deleteBatch",
        exportXlsUrl: "/modules.order/omsPayOffline/exportXls",
        importExcelUrl: "modules.order/omsPayOffline/importExcel",

      },
      dictOptions: {},
    }
  },
  created () {
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    open () {
      this.loadData()
    },
    setSelected () {
      this.pageCheckedKeys = []
      this.noPageCheckedKeys = []
      this.pageCheckedRows = []
      this.noPageCheckedRows = []
      for (let i = 0; i < this.checkedKeys.length; i++) {
        let isSelect = false
        for (let j = 0; j < this.dataSource.length; j++) {
          if (this.dataSource[j].id == this.checkedKeys[i]) {
            isSelect = true
          }
        }
        if (isSelect) {
          this.pageCheckedKeys.push(this.checkedKeys[i])
          this.pageCheckedRows.push(this.checkedRows[i])
        } else {
          this.noPageCheckedKeys.push(this.checkedKeys[i])
          this.noPageCheckedRows.push(this.checkedRows[i])
        }
      }
      this.selectedRowKeys = this.pageCheckedKeys
    },
    initDictConfig () {
    }
  }
}
        </script>
<style scoped>
@import '~@assets/less/common.less';
</style>
